<!DOCTYPE html>
<html>
<head>
    <title>订单管理</title>
    <#include "/include/base/header.ftl">
</head>
<body>
<div class="wrapper">
    <div class="main-content">
        <div class="box box-main">
            <div class="box-body">
                <form id="searchForm" action="${ctx}/mall/order/dataList" class="form-inline" onsubmit="return search();">
                    <div class="form-group">
                        <label class="control-label">商品名称：</label>
                        <div class="control-inline">
                            <input type="text" name="goodsName" value="" maxlength="100" class="form-control width-120" autocomplete="off" />
                        </div>
                    </div>
                    <div class="form-group">
                        <button type="submit" class="btn btn-primary btn-sm">查询</button>
                        <button type="reset" class="btn btn-default btn-sm">重置</button>
                    </div>
                </form>
                <table id="datatable" class="table table-hover table-striped table-bordered"></table>
            </div>
        </div>
    </div>
</div>
</body>
<#include "/include/base/footer.ftl">
<#include "/include/pagelist.ftl">
<script>
    $(function () {
        $("#datatable").datatable([
            {
                field: "id", title: "订单id", align: "center", width: "80",
                formatter: function (value, row, index) {
                    return '<span class="primary">'+value+'</span>';
                }
            },
            { field: "orderSn", title: "订单编号", align: "center", width: "300" },
            {
                field: "cartTotalMoney", title: "订单金额", align: "center", width: "100",
                formatter: function (value, row, index) {
                    return fenToYuan(value);
                }
            },{
                field: "orderFreightMoney", title: "运费", align: "center", width: "100",
                formatter: function (value, row, index) {
                    return fenToYuan(value);
                }
            },{
                field: "orderDiscountMoney", title: "优惠金额", align: "center", width: "100",
                formatter: function (value, row, index) {
                    return fenToYuan(value);
                }
            },{
                field: "orderPayMoney", title: "支付金额", align: "center", width: "100",
                formatter: function (value, row, index) {
                    return fenToYuan(value);
                }
            },
            {
                field: "createTime", title: "下单时间", align: "center", width: "200",
                formatter: function (value, row, index) {
                    console.log(row)
                    return value;
                }
            },
            { field: "showStatus", title: "订单状态", align: "center", width: "200" },
            { field: "showStatus", title: "支付方式", align: "center", width: "200" },
            {
                title: "操作",align: 'center', sortable: false,
                formatter: function(value, row, index){
                    var str = "";
                    str += '<a class="list-btn" href="javascript:void(0);" onclick="tableDialog(this)" data-type="show" data-width="850" data-height="700" data-offset="30" data-title="订单信息" data-href="${ctx}/mall/order/detail?id='+row.id+'"><span>查看订单</span></a>';
                    if(row.status == "1"){
                        <@shiro.hasPermission name="mall:order:delivery">
                            str += '<a class="list-btn" href="javascript:void(0);" onclick="tableDialog(this)" data-type="form" saveLabel="确认发货" data-width="850" data-title="发货" data-href="${ctx}/mall/order/deliveryForm?id='+row.id+'"><span>发货</span></a>';
                        </@shiro.hasPermission>
                    }
                    if(str == ""){ str = "-"; }
                    return str;
                }
            }
        ])
    })
</script>
</html>